/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MainFrame.java
 *
 * Created on Aug 17, 2009, 9:04:40 AM
 */

package com.Cloudtap.UI;

import java.awt.Toolkit.*;
import java.awt.*;
import javax.swing.*;
import java.util.*;
import com.Cloudtap.Backend.*;
/**
 *
 * @author Dharshan
 */
public class MainFrame extends javax.swing.JFrame {

    /** Creates new form MainFrame */
    public MainFrame() {
        
        //Initialize the components
        customInitComponents();

        //Set the frame state to maximized
        this.setExtendedState(getExtendedState() | Frame.MAXIMIZED_BOTH);

        assert this.mainTabbedPane != null;

        //Initialize the data
        DataModel model = new DataModel();

        //Add the tabs
        this.mainTabbedPane.add(new VMPanel(model),"Virtual Machines");
        this.mainTabbedPane.add(new JPanel(),"Images");
        this.mainTabbedPane.add(new JPanel(),"Network");
        this.mainTabbedPane.add(new JPanel(),"Monitoring");
        this.mainTabbedPane.add(new JPanel(),"Accounts");
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowOpened(java.awt.event.WindowEvent evt) {
                MainFramewindowOpenedHandler(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 460, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void MainFramewindowOpenedHandler(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_MainFramewindowOpenedHandler
    }//GEN-LAST:event_MainFramewindowOpenedHandler

    private void customInitComponents() {

        this.mainTabbedPane = new TabbedPane();
        
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(mainTabbedPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 460, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(mainTabbedPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
        );

        pack();
    }//
    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {

        //provide this data to the UI components
        //this.mainTabbedPane.

        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new MainFrame().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
    private TabbedPane mainTabbedPane;
}
